//
//  CommentCell.m
//  BuffetNews
//
//  Created by 大大大鸿哥 on 14/11/5.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CommentCell.h"

@implementation CommentCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //在cell的初始化方法中对自定义视图初始化
        //在初始化的时候，可以不指定frame
        self.headImage = [[UIImageView alloc]init];
        self.nameLabel = [[UILabel alloc]init];
        self.commentLabel = [[UILabel alloc]init];
        self.good = [UIButton buttonWithType:UIButtonTypeSystem];
        self.bad = [UIButton buttonWithType:UIButtonTypeSystem];
        self.dataLabel = [[UILabel alloc]init];
        
        
        [self.contentView addSubview:self.dataLabel];
        [self.contentView addSubview:self.good];
        [self.contentView addSubview:self.bad];
        [self.contentView addSubview:self.headImage];
        [self.contentView addSubview:self.nameLabel];
        [self.contentView addSubview:self.commentLabel];
        
        
        
        [_dataLabel release];
        [_headImage release];
        [_nameLabel release];
        [_commentLabel release];
    }
    return self;
}

- (void)dealloc
{
    [_headImage release];
    [_nameLabel release];
    [_commentLabel release];
    [_good release];
    [_bad release];
    [_dataLabel release];
    [super dealloc];
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    self.headImage.frame = CGRectMake(10, 20, 32, 32);
    
    self.nameLabel.frame = CGRectMake( 55, 20, self.contentView.frame.size.width * 4 / 5, 20);
    
    self.good.frame = CGRectMake(self.contentView.frame.size.width * 4 / 5 - 50, 50, 50, 20);
    [self.good.layer setBorderWidth:1];
    self.good.layer.cornerRadius = 5;
    [self.good setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.good.layer setBorderColor: [[UIColor grayColor]CGColor]];
    
    
    
    self.bad.frame = CGRectMake(self.contentView.frame.size.width * 4 / 5 + 20, 50, 20, 20);

    [self.bad setImage:[[UIImage imageNamed:@"g.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    self.dataLabel.frame = CGRectMake(55, 50, 100, 20);

    self.commentLabel.frame = CGRectMake(55, 75, self.contentView.frame.size.width * 4 / 5 - 20, 100);
    [self.commentLabel sizeToFit];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
